package 原型模式.深复制;

import java.util.ArrayList;
import java.util.List;

public class User implements Cloneable{
    String userName;
    String password;
    String email;
    int score;
    User friend;
    User(){

    }
    User(User friend){
        if (friend != null)
        this.friend = (User) friend.cloneI();
    }
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public User getFriend() {
        return friend;
    }

    public void setFriend(User friend) {
        this.friend = friend;
    }

    public Object cloneI()  {
        User user = new User(this.friend);
        user.setUserName(this.userName);
        user.setEmail(this.getEmail());
        user.setPassword(this.password);
        user.setScore(this.score);
        return user;

    }

}

